Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial nix #12347

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

syntacticsagar
Copy link

What? Why?

  • Closes #

What should we test?

  • Visit ... page.

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

@sigmundpetersen
Copy link
Contributor

Hi @syntacticsagar , thank you 👍
Can you explain a bit more what this does? Any references?

@openfoodfoundation/core-devs any feedback on this?

@syntacticsagar
Copy link
Author

@sigmundpetersen the core idea is to make onboarding experience for contributors as smooth as possible.

Once the PR is done, this is what the experience would look like:

  1. Dev clones the repo, sets up the pre-requisites (nix, nix-direnv)
  2. When the dev changes into the directory, direnv should automatically set up all the required dependencies for dev to be able to run bundle exec rails s

@syntacticsagar
Copy link
Author

syntacticsagar commented May 14, 2024

Slightly off-topic to the main PR: Another idea is to modularise the codebase using the packwerk (https://github.com/Shopify/packwerk) gem. I was not expecting such a quick response on the PR and was simply trying things out; didn't realise that those changes also made it to this PR; will move those out into another PR.

@sigmundpetersen
Copy link
Contributor

Thank you @syntacticsagar

@rioug
Copy link
Collaborator

rioug commented May 14, 2024

How is that different from something like Docker ?

re packwek it's a nice idea, but it would require a lot of work to apply that to our code base which we don't have the time for. But feel free to give it a go. I have used it in a previous project, but it's not easy to set up in an existing project.
If you have not seen it already, I would encourage you to read shopify retrospective : https://shopify.engineering/a-packwerk-retrospective.
In the same topic, I watched this recently : https://www.youtube.com/watch?v=StDoHXO8H6E . It's talking about using "light" rails engine to compartmentalise an app.

@syntacticsagar
Copy link
Author

syntacticsagar commented May 15, 2024

Thanks for the feedback and questions @rioug. Will check out the video about light engines.

How is that different from something like Docker ?

Well, first off nix is a package manager. So the problem this solves is different to what Docker solves which is to have a reproducible run-time environment. There's more details in this article: https://numtide.com/blog/nix-docker-or-both/

The crux of this PR is to make it super easy for devs to set up their local environment. If one dev is able to set it up, then the next shouldn't need to struggle with the same issues. And that's where nix is super handy.

Say you're working on a couple of different projects with different postgres versions or glibc versions, it's difficult to converge on a standard toolset across OSs that will easily allow you to contribute effectively to all of them. Nix solves that problem quite well.

Let me know if you have any further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress ⚙
Development

Successfully merging this pull request may close these issues.

3 participants